﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;

namespace MoqContrib.AutoMock.CommonService.Tests
{
    public class TestHelper : CommonServiceLocator.AutoMockHelper, All.Tests.IDoAutoMockHelperStuff<TestContainer>
    {
        private TestContainer _container;

        #region IDoAutoMockHelperStuff<TestContainer> Members

        public void InitializeDefault()
        {
            TestContainer = new TestContainer();
        }

        public TestContainer TestContainer
        {
            get { return _container; }
            set
            {
                _container = value;
                _container.Helper = this;
            }
        }

        public void AssertComponentNotFound<TService>() where TService : class
        {
            Assert.Throws<IndexOutOfRangeException>(() => TestContainer.GetInstance<TService>());
        }

        #endregion
    }
}
